///
/// [author]: liMing
/// [Date]: 2021-07-14  20:44
///
import 'package:flutter/material.dart';
import 'package:flutter_paint/day_4/page_paper.dart';


void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: ListView(
          padding: EdgeInsets.only(top: 50),
          children: [
            GestureDetector(
              behavior: HitTestBehavior.translucent,
              onTap: (){
                jump(1);
              },
              child: Container(
                width: 40,
                height: 40,
                margin: EdgeInsets.only(top: 20),
                color: Colors.yellowAccent[200],
                child: Center(child: Text('绘制图像')),
              ),
            ),
            GestureDetector(
              behavior: HitTestBehavior.translucent,
              onTap: (){
                jump(2);
              },
              child: Container(
                width: 40,
                height: 40,
                margin: EdgeInsets.only(top: 20),
                color: Colors.yellowAccent[200],
                child: Center(child: Text('基础图形绘制')),
              ),
            )
          ],
        ),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
  jump(int page){
    switch(page){
      case 1:
      Navigator.push(context, MaterialPageRoute(builder: (context)=>Paper()));
      break;
      case 2:
        // Navigator.push(context, MaterialPageRoute(builder: (context)=>PageCanvasDraw()));
        break;
    }
  }
}
